package com.rent.view;

import java.util.List;
import java.util.Scanner;

import com.rent.bean.Rent;
import com.rent.bean.Vip;
import com.rent.dao.RecordDao;
import com.rent.dao.VipDao;
import com.rent.Impl.RecordImpl;
import com.rent.Impl.VipDaoImpl;

public class Rentcha {
	RecordDao re=new RecordImpl();
	Scanner input=new Scanner(System.in);
	public void cha() {
		List<Rent> li=re.select();
		System.out.println("历史租车记录：");
		System.out.println("编号\t用户名\t车辆编号\t租车时间\t\t\t还车时间\t\t\t费用");
		for(Rent r:li) {
			System.out.println(r.getRid()+"\t"+r.getUname()+"\t "+r.getCid()+"\t"+r.getRtime()+"\t"+r.getBtime()+"\t"+r.getMoney());
		}
	}
	//管理员条件查询
	public void wcha() {
		System.out.println("请输入用户名:");
		String name=input.next();
		List<Rent> li=re.selectw(name);
		System.out.println("编号\t用户名\t车辆编号\t租车时间\t\t\t还车时间\t\t\t费用");
		for(Rent r:li) {
			System.out.println(r.getRid()+"\t"+r.getUname()+"\t "+r.getCid()+"\t"+r.getRtime()+"\t"+r.getBtime()+"\t"+r.getMoney());
		}
	}
	//会员查询
	public void vipcha() {
		VipDao vip=new VipDaoImpl();
		System.out.println("请输入用户名:");
		String name=input.next();
		List<Vip> li=vip.seleByUname(name);
		for(Vip l:li) {
			System.out.println(l.getVid()+"\t"+l.getUname()+"\t"+l.getOpentime()+"\t"+l.getLimittime());
		}
	}
}
